package website.digitalocean.chapter7;

import java.util.Objects;

/**
 * @author: longhc@citycloud.com.cn
 * @since: 2023/2/10 11:03
 * @version: 1.0
 */
public class ProxyImage implements Image {

    private RealImage realImage;
    private String name;

    public ProxyImage(String name) {
        this.name = name;
    }

    @Override
    public void display() {
        if (Objects.isNull(realImage)) {
            realImage = new RealImage(this.name);
        }
        realImage.display();
    }
}
